package cn.iocoder.yudao.module.polling.dal.mysql.pollingcategoriesrelevance;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategoriesrelevance.vo.PollingCategoriesRelevanceExportReqVO;
import cn.iocoder.yudao.module.polling.controller.admin.pollingcategoriesrelevance.vo.PollingCategoriesRelevancePageReqVO;
import cn.iocoder.yudao.module.polling.dal.dataobject.pollingcategoriesrelevance.PollingCategoriesRelevanceDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 巡检标准适用类别关联 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface PollingCategoriesRelevanceMapper extends BaseMapperX<PollingCategoriesRelevanceDO> {

    default PageResult<PollingCategoriesRelevanceDO> selectPage(PollingCategoriesRelevancePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PollingCategoriesRelevanceDO>()
                .betweenIfPresent(PollingCategoriesRelevanceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingCategoriesRelevanceDO::getPollingId, reqVO.getPollingId())
                .eqIfPresent(PollingCategoriesRelevanceDO::getCateId, reqVO.getCateId())
                .orderByDesc(PollingCategoriesRelevanceDO::getId));
    }

    default List<PollingCategoriesRelevanceDO> selectList(PollingCategoriesRelevanceExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PollingCategoriesRelevanceDO>()
                .betweenIfPresent(PollingCategoriesRelevanceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingCategoriesRelevanceDO::getPollingId, reqVO.getPollingId())
                .eqIfPresent(PollingCategoriesRelevanceDO::getCateId, reqVO.getCateId())
                .orderByDesc(PollingCategoriesRelevanceDO::getId));
    }

}
